package com.cvmars.jianyou.config;

import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.support.multidex.MultiDexApplication;
import android.util.Log;

import com.aitangba.swipeback.ActivityLifecycleHelper;
import com.orhanobut.hawk.Hawk;

import io.rong.imkit.RongIM;
import io.rong.imlib.RongIMClient;

/**
 * Created by hehaifeng on 2018/6/1.
 */

public class MyApp extends MultiDexApplication {

    public static MyApp instance;

    public static MyApp getApplication() {
        return instance;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        instance = this;
        RongIM.init(this);
        Hawk.init(this).build();
        registerActivityLifecycleCallbacks(ActivityLifecycleHelper.build());
    }


    /**
     * 获取App安装包信息
     *
     * @return
     */
    public PackageInfo getPackageInfo() {
        PackageInfo info = null;
        try {
            info = getPackageManager().getPackageInfo(getPackageName(), 0);
        } catch (PackageManager.NameNotFoundException e) {
        }
        if (info == null)
            info = new PackageInfo();
        return info;
    }


}
